//
//  HBgetProductInfoParser.m
//  HuoBao
//
//  Created by sky on 15/12/2.
//  Copyright © 2015年 jinxin. All rights reserved.
//

#import "HBgetProductInfoParser.h"
#import "HBgetProductInfoItemInfo.h"

@implementation HBgetProductInfoParser


-(ParserResult*)parseResponseDictionary:(NSDictionary *)responseDictionary
{
    LLog(@"responseDictionary:%@",responseDictionary);
    ParserResult* result=[[ParserResult alloc]init];
    NSNumber* codeObject=[responseDictionary objectForKey:Key_Code];
    if (codeObject)
    {
        NSInteger code = [codeObject integerValue];
        result.code = code;
        result.message = [responseDictionary objectForKey:Key_Msg];
        if (code == 0)
        {
            NSDictionary *dataDict = [responseDictionary objectForKey:Key_Data];
            if (dataDict&&[dataDict isKindOfClass:[NSDictionary class]])
            {
                HBgetProductInfoItemInfo *info = [[HBgetProductInfoItemInfo alloc]init];
                info.productName = [DataTypeTranslate stringToString:dataDict[Key_productName]];
                info.productCode = [DataTypeTranslate stringToString:dataDict[Key_productCode]];
                info.interestRate = [DataTypeTranslate numberToString:dataDict[Key_interestRate]];
                info.increaseRate = [DataTypeTranslate numberToString:dataDict[Key_increaseRate]];
                info.productUrl   = [DataTypeTranslate stringToString:dataDict[Key_productUrl]];
                result.result = info;
            }
            
        }
    }
    else
    {
        result.code=1;
        result.message=@"服务器数据异常";
    }
    
    return result;
}



@end
